cmake_minimum_required(VERSION 3.10)

project(CalSqrt)

set(CalSqrt_Version_Major 1)
set(CalSqrt_Version_Minor 0)

option(USE_MYMATH "Use tutorial provided math implementation" ON)

# specify the C++ standard 
set(CMAKE_CXX_STANDARD 11) 
set(CMAKE_CXX_STANDARD_REQUIRED True)

configure_file(calSqrtConfig.h.in calSqrtConfig.h)

# include_directories("${PROJECT_BINARY_DIR}")

if(USE_MYMATH)
  add_subdirectory(MathFunctions) 
  list(APPEND EXTRA_LIBS MathFunctions)
  list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/MathFunctions") 
endif()


add_executable(CalSqrt calSqrt.cpp)

target_link_libraries(CalSqrt PUBLIC ${EXTRA_LIBS}) 

target_include_directories(CalSqrt PUBLIC
                           "${PROJECT_BINARY_DIR}" 
                           "${EXTRA_INCLUDES}" 
                           )

# target_include_directories(CalSqrt PUBLIC_HEADER "${PROJECT_BINARY_DIR}")
